import {CurrentTab} from "common.slint";
import {SelectModel, SortModel, SelectMode, SortMode, BottomPanelVisibility} from "common.slint";
import { Translations } from "translations.slint";

// State Gui state that shows the current state of the GUI
// It extends Settings global state with settings that are not saved to the settings file
export global GuiState {
    in-out property <length> app_width;
    in-out property <length> app_height;

    in-out property <string> info_text: "Nothing to report";
    in-out property <bool> preview_visible;
    in-out property <image> preview_image;
    in-out property <string> preview_image_path;

    in-out property <length> left_panel_width: 120px;

    in-out property <float> maximum_threads: 40;

    in-out property <bool> choosing_include_directories;
    in-out property <bool> visible_tool_settings;

    in-out property <bool> available_subsettings: active_tab == CurrentTab.SimilarImages || active_tab == CurrentTab.DuplicateFiles || active_tab == CurrentTab.SimilarVideos || active_tab == CurrentTab.SimilarMusic || active_tab == CurrentTab.BigFiles || active_tab == CurrentTab.BrokenFiles;
    in-out property <CurrentTab> active_tab: CurrentTab.DuplicateFiles;
    in-out property <bool> is_tool_tab_active: active_tab != CurrentTab.Settings && active_tab != CurrentTab.About;

    in-out property <[SelectModel]> select_results_list: [
        { data: SelectMode.SelectAll, name: Translations.selection_all_text },
        { data: SelectMode.UnselectAll, name: Translations.selection_deselect_all_text },
        {
            data: SelectMode.SelectTheSmallestResolution,
            name: Translations.selection_the_smallest_resolution_text
        }
    ];

    in-out property <[SortModel]> sort_results_list: [
        { data: SortMode.ItemName, name: Translations.sort_by_item_name_text },
        { data: SortMode.ParentName, name: Translations.sort_by_parent_name_text },
        { data: SortMode.FullName, name: Translations.sort_by_full_name_text },
        { data: SortMode.Size, name: Translations.sort_by_size_text },
        { data: SortMode.ModificationDate, name: Translations.sort_by_modification_date_text },
        { data: SortMode.Selection, name: Translations.sort_by_selection_text },
        { data: SortMode.Reverse, name: Translations.sort_reverse_text }
    ];

    in-out property <[{name: string, tab: CurrentTab}]> tools_model: [
        { name: Translations.tool_duplicate_files_text, tab: CurrentTab.DuplicateFiles },
        { name: Translations.tool_empty_folders_text, tab: CurrentTab.EmptyFolders },
        { name: Translations.tool_big_files_text, tab: CurrentTab.BigFiles },
        { name: Translations.tool_empty_files_text, tab: CurrentTab.EmptyFiles },
        { name: Translations.tool_temporary_files_text, tab: CurrentTab.TemporaryFiles },
        { name: Translations.tool_similar_images_text, tab: CurrentTab.SimilarImages },
        { name: Translations.tool_similar_videos_text, tab: CurrentTab.SimilarVideos },
        { name: Translations.tool_music_duplicates_text, tab: CurrentTab.SimilarMusic },
        { name: Translations.tool_invalid_symlinks_text, tab: CurrentTab.InvalidSymlinks },
        { name: Translations.tool_broken_files_text, tab: CurrentTab.BrokenFiles },
        { name: Translations.tool_bad_extensions_text, tab: CurrentTab.BadExtensions }
    ];

    in-out property <BottomPanelVisibility> bottom_panel_visibility: BottomPanelVisibility.Directories;
}
